home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.3 KB | 133 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWMemMgr.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWMEMMGR_H
- #define FWMEMMGR_H
-
- #ifndef SLMEMMGR_H
- #include "SLMemMgr.h"
- #endif
-
- //========================================================================================
- // CLASS FW_CMemoryManager
- //========================================================================================
-
- class FW_CMemoryManager
- {
- public:
-
- // Utility routines for manipulating blocks of memory
- static void CopyMemory(const void* const source,
- void* const destination,
- unsigned long bytesToMove);
- static void SetMemory(void* aBlock,
- unsigned long bytesToSet,
- unsigned char byteValue);
- static void* AddOffsetToPointer(void* pointer,
- unsigned long offset);
-
- // when resizable, pointer-based blocks are needed:
- static void* AllocateBlock(unsigned long bytesRequested);
- static void* ResizeBlock(void* aBlock, unsigned long bytesRequested);
- static unsigned long GetBlockSize(const void* aBlock);
- static void FreeBlock(void* aBlock);
-
- // when platform specific handles are needed:
- static FW_PlatformHandle AllocateSystemHandle(unsigned long bytesRequested);
- static FW_PlatformHandle ResizeSystemHandle(FW_PlatformHandle aHandle,
- unsigned long bytesRequested);
- static void FreeSystemHandle(FW_PlatformHandle aHandle);
- static void* LockSystemHandle(FW_PlatformHandle aHandle);
- static void UnlockSystemHandle(FW_PlatformHandle aHandle);
- static unsigned long GetSystemHandleSize(FW_PlatformHandle aHandle);
- static FW_PlatformHandle CopySystemHandle(FW_PlatformHandle aHandle);
-
- //internal methods
- // when resizable, pointer-based blocks are needed, no debug checking:
- static void DefaultNewHandler();
-
- private:
- FW_CMemoryManager() {};
- // abstract class. Note that all methods are statics.
- };
-
- //========================================================================================
- // FW_CMemoryManager inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::CopyMemory -
- //----------------------------------------------------------------------------------------
- inline void FW_CMemoryManager::CopyMemory(const void* const source,
- void* const destination,
- unsigned long bytesToMove)
- {
- FW_PrivMemoryManager_CopyMemory(source, destination, bytesToMove);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::SetMemory -
- //----------------------------------------------------------------------------------------
- inline void FW_CMemoryManager::SetMemory(void* aBlock,
- unsigned long bytesToSet,
- unsigned char byteValue)
- {
- FW_PrivMemoryManager_SetMemory(aBlock, bytesToSet, byteValue);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::AddOffsetToPointer
- //----------------------------------------------------------------------------------------
- inline void* FW_CMemoryManager::AddOffsetToPointer(void* pointer, unsigned long offset)
- {
- return FW_PrivMemoryManager_AddOffsetToPointer(pointer, offset);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::GetBlockSize - Return a non-relocatable block to the free store.
- //----------------------------------------------------------------------------------------
- inline unsigned long FW_CMemoryManager::GetBlockSize(const void* aBlock)
- {
- return FW_PrivMemoryManager_GetBlockSize(aBlock);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::FreeBlock - Return a non-relocatable block to the free store.
- //----------------------------------------------------------------------------------------
- inline void FW_CMemoryManager::FreeBlock(void* aBlock)
- {
- FW_PrivMemoryManager_FreeBlock(aBlock);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::FreeSystemHandle -
- //----------------------------------------------------------------------------------------
- inline void FW_CMemoryManager::FreeSystemHandle(FW_PlatformHandle aHandle)
- {
- FW_PrivMemoryManager_FreeSystemHandle(aHandle);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::UnlockSystemHandle -
- //----------------------------------------------------------------------------------------
- inline void FW_CMemoryManager::UnlockSystemHandle(FW_PlatformHandle aHandle)
- {
- FW_PrivMemoryManager_UnlockSystemHandle(aHandle);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CMemoryManager::GetSystemHandleSize
- //----------------------------------------------------------------------------------------
- inline unsigned long FW_CMemoryManager::GetSystemHandleSize(FW_PlatformHandle aHandle)
- {
- return FW_PrivMemoryManager_GetSystemHandleSize(aHandle);
- }
-
- #endif
-